Carga y limpieza preliminar de los datos

Los datos que se van a analizar en este documento, proceden de la compilación hecha por usuarios de Kaggle. La fecha del análisis empieza el 6 de Abril de 2020, utilizando la versión número 73 recopilada en la web anterior.

datos <- read.csv("covid_19_clean_complete.csv")
View(datos)
datos %>% head(10) %>% kable() %>% kable_styling()
Province.State Country.Region Lat Long Date Confirmed Deaths Recovered Active WHO.Region
Afghanistan 33.93911 67.70995 2020-01-22 0 0 0 0 Eastern Mediterranean
Albania 41.15330 20.16830 2020-01-22 0 0 0 0 Europe
Algeria 28.03390 1.65960 2020-01-22 0 0 0 0 Africa
Andorra 42.50630 1.52180 2020-01-22 0 0 0 0 Europe
Angola -11.20270 17.87390 2020-01-22 0 0 0 0 Africa
Antigua and Barbuda 17.06080 -61.79640 2020-01-22 0 0 0 0 Americas
Argentina -38.41610 -63.61670 2020-01-22 0 0 0 0 Americas
Armenia 40.06910 45.03820 2020-01-22 0 0 0 0 Europe
Australian Capital Territory Australia -35.47350 149.01240 2020-01-22 0 0 0 0 Western Pacific
New South Wales Australia -33.86880 151.20930 2020-01-22 0 0 0 0 Western Pacific

Estructura de los datos

str(datos)
## 'data.frame':    49068 obs. of  10 variables:
##  $ Province.State: chr  "" "" "" "" ...
##  $ Country.Region: chr  "Afghanistan" "Albania" "Algeria" "Andorra" ...
##  $ Lat           : num  33.9 41.2 28 42.5 -11.2 ...
##  $ Long          : num  67.71 20.17 1.66 1.52 17.87 ...
##  $ Date          : chr  "2020-01-22" "2020-01-22" "2020-01-22" "2020-01-22" ...
##  $ Confirmed     : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ Deaths        : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ Recovered     : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ Active        : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ WHO.Region    : chr  "Eastern Mediterranean" "Europe" "Africa" "Europe" ...
colnames(datos) = c("Provincia_Estado",
                    "Pais_Region",
                    "Latitud", # N+ o S-
                    "Longitud", # E+ o W-
                    "Fecha",
                    "Casos_Confirmados",
                    "Casos_Muertos",
                    "Casos_Recuperados",
                    "Casos_Activos",
                    "WHO_Region"
                    )
datos %>% head() %>% kable() %>% kable_styling()
Provincia_Estado Pais_Region Latitud Longitud Fecha Casos_Confirmados Casos_Muertos Casos_Recuperados Casos_Activos WHO_Region
Afghanistan 33.93911 67.70995 2020-01-22 0 0 0 0 Eastern Mediterranean
Albania 41.15330 20.16830 2020-01-22 0 0 0 0 Europe
Algeria 28.03390 1.65960 2020-01-22 0 0 0 0 Africa
Andorra 42.50630 1.52180 2020-01-22 0 0 0 0 Europe
Angola -11.20270 17.87390 2020-01-22 0 0 0 0 Africa
Antigua and Barbuda 17.06080 -61.79640 2020-01-22 0 0 0 0 Americas
  • Cualitativas se convierten con factor o bien as.factor.
  • Ordinales se convierten con ordered.
  • Cuantitativos se convierten con as.numeric.
datos$Provincia_Estado<- as.factor(datos$Provincia_Estado)
datos$Pais_Region<- as.factor(datos$Pais_Region)
datos$Fecha<-as.factor(datos$Fecha)

Cambia de Caracteres o Factor a Fecha

datos$Fecha %<>% as.Date(format="%Y-%m-%d")
str(datos)
## 'data.frame':    49068 obs. of  10 variables:
##  $ Provincia_Estado : Factor w/ 79 levels "","Alberta","Anguilla",..: 1 1 1 1 1 1 1 1 6 47 ...
##  $ Pais_Region      : Factor w/ 187 levels "Afghanistan",..: 1 2 3 4 5 6 7 8 9 9 ...
##  $ Latitud          : num  33.9 41.2 28 42.5 -11.2 ...
##  $ Longitud         : num  67.71 20.17 1.66 1.52 17.87 ...
##  $ Fecha            : Date, format: "2020-01-22" "2020-01-22" ...
##  $ Casos_Confirmados: int  0 0 0 0 0 0 0 0 0 0 ...
##  $ Casos_Muertos    : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ Casos_Recuperados: int  0 0 0 0 0 0 0 0 0 0 ...
##  $ Casos_Activos    : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ WHO_Region       : chr  "Eastern Mediterranean" "Europe" "Africa" "Europe" ...

Uso de lubridate

#datos$Fecha %<>% mdy()
datos %<>%
  mutate(Casos_Enfermos = Casos_Confirmados - Casos_Muertos - Casos_Recuperados)
datos %>% filter(Casos_Confirmados > 100000) %>% head(10) %>% kable() %>% kable_styling()
Provincia_Estado Pais_Region Latitud Longitud Fecha Casos_Confirmados Casos_Muertos Casos_Recuperados Casos_Activos WHO_Region Casos_Enfermos
US 40.00000 -100.00000 2020-03-27 102276 2300 869 99107 Americas 99107
US 40.00000 -100.00000 2020-03-28 122069 2934 1072 118063 Americas 118063
US 40.00000 -100.00000 2020-03-29 141205 3561 2665 134979 Americas 134979
Italy 41.87194 12.56738 2020-03-30 101739 11591 14620 75528 Europe 75528
US 40.00000 -100.00000 2020-03-30 162707 4381 5644 152682 Americas 152682
Italy 41.87194 12.56738 2020-03-31 105792 12428 15729 77635 Europe 77635
US 40.00000 -100.00000 2020-03-31 188724 5605 7024 176095 Americas 176095
Italy 41.87194 12.56738 2020-04-01 110574 13155 16847 80572 Europe 80572
Spain 40.46367 -3.74922 2020-04-01 104118 9387 22647 72084 Europe 72084
US 40.00000 -100.00000 2020-04-01 214205 6846 8474 198885 Americas 198885
datos %>% filter(Casos_Enfermos <0) %>% kable() %>% kable_styling()
Provincia_Estado Pais_Region Latitud Longitud Fecha Casos_Confirmados Casos_Muertos Casos_Recuperados Casos_Activos WHO_Region Casos_Enfermos
Hainan China 19.195900 109.74530 2020-03-24 168 6 168 -6 Western Pacific -6
Hainan China 19.195900 109.74530 2020-03-25 168 6 168 -6 Western Pacific -6
Hainan China 19.195900 109.74530 2020-03-26 168 6 168 -6 Western Pacific -6
Hainan China 19.195900 109.74530 2020-03-27 168 6 168 -6 Western Pacific -6
Hainan China 19.195900 109.74530 2020-03-28 168 6 168 -6 Western Pacific -6
Hainan China 19.195900 109.74530 2020-03-29 168 6 168 -6 Western Pacific -6
Hainan China 19.195900 109.74530 2020-03-30 168 6 168 -6 Western Pacific -6
Hainan China 19.195900 109.74530 2020-03-31 168 6 168 -6 Western Pacific -6
Hainan China 19.195900 109.74530 2020-04-01 168 6 168 -6 Western Pacific -6
Channel Islands United Kingdom 49.372300 -2.36440 2020-05-23 558 45 515 -2 Europe -2
Channel Islands United Kingdom 49.372300 -2.36440 2020-05-24 558 45 517 -4 Europe -4
Channel Islands United Kingdom 49.372300 -2.36440 2020-05-25 559 45 517 -3 Europe -3
Channel Islands United Kingdom 49.372300 -2.36440 2020-05-30 560 45 525 -10 Europe -10
Channel Islands United Kingdom 49.372300 -2.36440 2020-05-31 560 45 528 -13 Europe -13
Channel Islands United Kingdom 49.372300 -2.36440 2020-06-01 560 45 528 -13 Europe -13
Channel Islands United Kingdom 49.372300 -2.36440 2020-06-02 560 46 528 -14 Europe -14
Liechtenstein 47.140000 9.55000 2020-06-23 82 2 81 -1 Europe -1
Uganda 1.373333 32.29028 2020-07-20 1069 0 1071 -2 Africa -2
datos %>% filter(Provincia_Estado == "Hainan" ) %>% kable() %>% kable_styling()
Provincia_Estado Pais_Region Latitud Longitud Fecha Casos_Confirmados Casos_Muertos Casos_Recuperados Casos_Activos WHO_Region Casos_Enfermos
Hainan China 19.1959 109.7453 2020-01-22 4 0 0 4 Western Pacific 4
Hainan China 19.1959 109.7453 2020-01-23 5 0 0 5 Western Pacific 5
Hainan China 19.1959 109.7453 2020-01-24 8 0 0 8 Western Pacific 8
Hainan China 19.1959 109.7453 2020-01-25 19 0 0 19 Western Pacific 19
Hainan China 19.1959 109.7453 2020-01-26 22 0 0 22 Western Pacific 22
Hainan China 19.1959 109.7453 2020-01-27 33 1 0 32 Western Pacific 32
Hainan China 19.1959 109.7453 2020-01-28 40 1 0 39 Western Pacific 39
Hainan China 19.1959 109.7453 2020-01-29 43 1 0 42 Western Pacific 42
Hainan China 19.1959 109.7453 2020-01-30 46 1 1 44 Western Pacific 44
Hainan China 19.1959 109.7453 2020-01-31 52 1 1 50 Western Pacific 50
Hainan China 19.1959 109.7453 2020-02-01 62 1 1 60 Western Pacific 60
Hainan China 19.1959 109.7453 2020-02-02 64 1 4 59 Western Pacific 59
Hainan China 19.1959 109.7453 2020-02-03 72 1 4 67 Western Pacific 67
Hainan China 19.1959 109.7453 2020-02-04 80 1 5 74 Western Pacific 74
Hainan China 19.1959 109.7453 2020-02-05 99 1 5 93 Western Pacific 93
Hainan China 19.1959 109.7453 2020-02-06 106 1 8 97 Western Pacific 97
Hainan China 19.1959 109.7453 2020-02-07 117 2 10 105 Western Pacific 105
Hainan China 19.1959 109.7453 2020-02-08 124 2 14 108 Western Pacific 108
Hainan China 19.1959 109.7453 2020-02-09 131 3 19 109 Western Pacific 109
Hainan China 19.1959 109.7453 2020-02-10 138 3 19 116 Western Pacific 116
Hainan China 19.1959 109.7453 2020-02-11 144 3 20 121 Western Pacific 121
Hainan China 19.1959 109.7453 2020-02-12 157 4 27 126 Western Pacific 126
Hainan China 19.1959 109.7453 2020-02-13 157 4 30 123 Western Pacific 123
Hainan China 19.1959 109.7453 2020-02-14 159 4 43 112 Western Pacific 112
Hainan China 19.1959 109.7453 2020-02-15 162 4 39 119 Western Pacific 119
Hainan China 19.1959 109.7453 2020-02-16 162 4 52 106 Western Pacific 106
Hainan China 19.1959 109.7453 2020-02-17 163 4 59 100 Western Pacific 100
Hainan China 19.1959 109.7453 2020-02-18 163 4 79 80 Western Pacific 80
Hainan China 19.1959 109.7453 2020-02-19 168 4 84 80 Western Pacific 80
Hainan China 19.1959 109.7453 2020-02-20 168 4 86 78 Western Pacific 78
Hainan China 19.1959 109.7453 2020-02-21 168 4 95 69 Western Pacific 69
Hainan China 19.1959 109.7453 2020-02-22 168 4 104 60 Western Pacific 60
Hainan China 19.1959 109.7453 2020-02-23 168 5 106 57 Western Pacific 57
Hainan China 19.1959 109.7453 2020-02-24 168 5 116 47 Western Pacific 47
Hainan China 19.1959 109.7453 2020-02-25 168 5 124 39 Western Pacific 39
Hainan China 19.1959 109.7453 2020-02-26 168 5 129 34 Western Pacific 34
Hainan China 19.1959 109.7453 2020-02-27 168 5 131 32 Western Pacific 32
Hainan China 19.1959 109.7453 2020-02-28 168 5 133 30 Western Pacific 30
Hainan China 19.1959 109.7453 2020-02-29 168 5 148 15 Western Pacific 15
Hainan China 19.1959 109.7453 2020-03-01 168 5 149 14 Western Pacific 14
Hainan China 19.1959 109.7453 2020-03-02 168 5 151 12 Western Pacific 12
Hainan China 19.1959 109.7453 2020-03-03 168 5 155 8 Western Pacific 8
Hainan China 19.1959 109.7453 2020-03-04 168 5 158 5 Western Pacific 5
Hainan China 19.1959 109.7453 2020-03-05 168 6 158 4 Western Pacific 4
Hainan China 19.1959 109.7453 2020-03-06 168 6 158 4 Western Pacific 4
Hainan China 19.1959 109.7453 2020-03-07 168 6 158 4 Western Pacific 4
Hainan China 19.1959 109.7453 2020-03-08 168 6 159 3 Western Pacific 3
Hainan China 19.1959 109.7453 2020-03-09 168 6 159 3 Western Pacific 3
Hainan China 19.1959 109.7453 2020-03-10 168 6 159 3 Western Pacific 3
Hainan China 19.1959 109.7453 2020-03-11 168 6 159 3 Western Pacific 3
Hainan China 19.1959 109.7453 2020-03-12 168 6 160 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-03-13 168 6 160 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-03-14 168 6 160 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-03-15 168 6 160 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-03-16 168 6 161 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-03-17 168 6 161 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-03-18 168 6 161 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-03-19 168 6 161 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-03-20 168 6 161 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-03-21 168 6 161 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-03-22 168 6 161 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-03-23 168 6 161 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-03-24 168 6 168 -6 Western Pacific -6
Hainan China 19.1959 109.7453 2020-03-25 168 6 168 -6 Western Pacific -6
Hainan China 19.1959 109.7453 2020-03-26 168 6 168 -6 Western Pacific -6
Hainan China 19.1959 109.7453 2020-03-27 168 6 168 -6 Western Pacific -6
Hainan China 19.1959 109.7453 2020-03-28 168 6 168 -6 Western Pacific -6
Hainan China 19.1959 109.7453 2020-03-29 168 6 168 -6 Western Pacific -6
Hainan China 19.1959 109.7453 2020-03-30 168 6 168 -6 Western Pacific -6
Hainan China 19.1959 109.7453 2020-03-31 168 6 168 -6 Western Pacific -6
Hainan China 19.1959 109.7453 2020-04-01 168 6 168 -6 Western Pacific -6
Hainan China 19.1959 109.7453 2020-04-02 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-03 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-04 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-05 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-06 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-07 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-08 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-09 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-10 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-11 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-12 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-13 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-14 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-15 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-16 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-17 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-18 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-19 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-20 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-21 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-22 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-23 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-24 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-25 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-26 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-27 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-28 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-29 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-04-30 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-01 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-02 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-03 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-04 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-05 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-06 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-07 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-08 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-09 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-10 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-11 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-12 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-13 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-14 168 6 162 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-15 169 6 162 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-05-16 169 6 162 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-05-17 169 6 162 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-05-18 169 6 162 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-05-19 169 6 162 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-05-20 169 6 162 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-05-21 169 6 162 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-05-22 169 6 162 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-05-23 169 6 162 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-05-24 169 6 162 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-05-25 169 6 162 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-05-26 169 6 162 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-05-27 169 6 162 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-05-28 169 6 162 1 Western Pacific 1
Hainan China 19.1959 109.7453 2020-05-29 169 6 163 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-30 169 6 163 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-05-31 169 6 163 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-06-01 169 6 163 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-06-02 169 6 163 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-06-03 169 6 163 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-06-04 169 6 163 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-06-05 169 6 163 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-06-06 170 6 162 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-06-07 170 6 162 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-06-08 170 6 162 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-06-09 170 6 162 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-06-10 170 6 162 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-06-11 170 6 162 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-06-12 171 6 162 3 Western Pacific 3
Hainan China 19.1959 109.7453 2020-06-13 171 6 162 3 Western Pacific 3
Hainan China 19.1959 109.7453 2020-06-14 171 6 162 3 Western Pacific 3
Hainan China 19.1959 109.7453 2020-06-15 171 6 163 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-06-16 171 6 163 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-06-17 171 6 163 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-06-18 171 6 163 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-06-19 171 6 163 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-06-20 171 6 163 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-06-21 171 6 163 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-06-22 171 6 163 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-06-23 171 6 163 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-06-24 171 6 163 2 Western Pacific 2
Hainan China 19.1959 109.7453 2020-06-25 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-06-26 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-06-27 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-06-28 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-06-29 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-06-30 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-01 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-02 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-03 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-04 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-05 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-06 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-07 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-08 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-09 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-10 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-11 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-12 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-13 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-14 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-15 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-16 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-17 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-18 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-19 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-20 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-21 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-22 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-23 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-24 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-25 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-26 171 6 165 0 Western Pacific 0
Hainan China 19.1959 109.7453 2020-07-27 171 6 165 0 Western Pacific 0
datos %>% filter(Pais_Region == "Chile") %>% kable() %>% kable_styling()
Provincia_Estado Pais_Region Latitud Longitud Fecha Casos_Confirmados Casos_Muertos Casos_Recuperados Casos_Activos WHO_Region Casos_Enfermos
Chile -35.6751 -71.543 2020-01-22 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-01-23 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-01-24 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-01-25 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-01-26 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-01-27 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-01-28 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-01-29 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-01-30 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-01-31 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-01 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-02 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-03 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-04 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-05 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-06 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-07 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-08 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-09 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-10 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-11 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-12 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-13 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-14 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-15 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-16 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-17 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-18 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-19 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-20 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-21 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-22 0 0 0 0 Americas 0
Chile -35.6751 -71.543 2020-02-23 2 0 0 2 Americas 2
Chile -35.6751 -71.543 2020-02-24 2 0 0 2 Americas 2
Chile -35.6751 -71.543 2020-02-25 2 0 0 2 Americas 2
Chile -35.6751 -71.543 2020-02-26 2 0 0 2 Americas 2
Chile -35.6751 -71.543 2020-02-27 2 0 0 2 Americas 2
Chile -35.6751 -71.543 2020-02-28 2 0 0 2 Americas 2
Chile -35.6751 -71.543 2020-02-29 2 0 0 2 Americas 2
Chile -35.6751 -71.543 2020-03-01 9 0 0 9 Americas 9
Chile -35.6751 -71.543 2020-03-02 9 0 0 9 Americas 9
Chile -35.6751 -71.543 2020-03-03 10 0 0 10 Americas 10
Chile -35.6751 -71.543 2020-03-04 10 0 0 10 Americas 10
Chile -35.6751 -71.543 2020-03-05 13 0 0 13 Americas 13
Chile -35.6751 -71.543 2020-03-06 13 0 0 13 Americas 13
Chile -35.6751 -71.543 2020-03-07 13 0 0 13 Americas 13
Chile -35.6751 -71.543 2020-03-08 20 0 0 20 Americas 20
Chile -35.6751 -71.543 2020-03-09 20 0 0 20 Americas 20
Chile -35.6751 -71.543 2020-03-10 25 0 0 25 Americas 25
Chile -35.6751 -71.543 2020-03-11 35 0 0 35 Americas 35
Chile -35.6751 -71.543 2020-03-12 35 0 0 35 Americas 35
Chile -35.6751 -71.543 2020-03-13 55 0 0 55 Americas 55
Chile -35.6751 -71.543 2020-03-14 88 0 0 88 Americas 88
Chile -35.6751 -71.543 2020-03-15 101 0 0 101 Americas 101
Chile -35.6751 -71.543 2020-03-16 182 0 0 182 Americas 182
Chile -35.6751 -71.543 2020-03-17 228 0 0 228 Americas 228
Chile -35.6751 -71.543 2020-03-18 265 0 0 265 Americas 265
Chile -35.6751 -71.543 2020-03-19 265 0 0 265 Americas 265
Chile -35.6751 -71.543 2020-03-20 461 0 6 455 Americas 455
Chile -35.6751 -71.543 2020-03-21 592 0 6 586 Americas 586
Chile -35.6751 -71.543 2020-03-22 687 1 8 678 Americas 678
Chile -35.6751 -71.543 2020-03-23 801 2 8 791 Americas 791
Chile -35.6751 -71.543 2020-03-24 977 2 17 958 Americas 958
Chile -35.6751 -71.543 2020-03-25 1197 3 22 1172 Americas 1172
Chile -35.6751 -71.543 2020-03-26 1361 4 22 1335 Americas 1335
Chile -35.6751 -71.543 2020-03-27 1665 5 43 1617 Americas 1617
Chile -35.6751 -71.543 2020-03-28 2015 6 61 1948 Americas 1948
Chile -35.6751 -71.543 2020-03-29 2245 7 75 2163 Americas 2163
Chile -35.6751 -71.543 2020-03-30 2555 8 156 2391 Americas 2391
Chile -35.6751 -71.543 2020-03-31 2844 12 156 2676 Americas 2676
Chile -35.6751 -71.543 2020-04-01 3137 16 234 2887 Americas 2887
Chile -35.6751 -71.543 2020-04-02 3510 18 335 3157 Americas 3157
Chile -35.6751 -71.543 2020-04-03 3843 22 427 3394 Americas 3394
Chile -35.6751 -71.543 2020-04-04 4355 27 528 3800 Americas 3800
Chile -35.6751 -71.543 2020-04-05 4665 34 618 4013 Americas 4013
Chile -35.6751 -71.543 2020-04-06 5009 37 728 4244 Americas 4244
Chile -35.6751 -71.543 2020-04-07 5310 43 898 4369 Americas 4369
Chile -35.6751 -71.543 2020-04-08 5740 48 1115 4577 Americas 4577
Chile -35.6751 -71.543 2020-04-09 6166 57 1274 4835 Americas 4835
Chile -35.6751 -71.543 2020-04-10 6695 65 1571 5059 Americas 5059
Chile -35.6751 -71.543 2020-04-11 7366 73 1864 5429 Americas 5429
Chile -35.6751 -71.543 2020-04-12 7652 80 2059 5513 Americas 5513
Chile -35.6751 -71.543 2020-04-13 7964 82 2367 5515 Americas 5515
Chile -35.6751 -71.543 2020-04-14 8356 92 2646 5618 Americas 5618
Chile -35.6751 -71.543 2020-04-15 8712 94 2937 5681 Americas 5681
Chile -35.6751 -71.543 2020-04-16 9246 105 3299 5842 Americas 5842
Chile -35.6751 -71.543 2020-04-17 9691 116 3621 5954 Americas 5954
Chile -35.6751 -71.543 2020-04-18 10598 126 4035 6437 Americas 6437
Chile -35.6751 -71.543 2020-04-19 10956 133 4338 6485 Americas 6485
Chile -35.6751 -71.543 2020-04-20 11375 139 4676 6560 Americas 6560
Chile -35.6751 -71.543 2020-04-21 11700 147 4969 6584 Americas 6584
Chile -35.6751 -71.543 2020-04-22 12164 160 5386 6618 Americas 6618
Chile -35.6751 -71.543 2020-04-23 12680 168 5804 6708 Americas 6708
Chile -35.6751 -71.543 2020-04-24 13174 174 6327 6673 Americas 6673
Chile -35.6751 -71.543 2020-04-25 14537 181 6746 7610 Americas 7610
Chile -35.6751 -71.543 2020-04-26 15010 189 7024 7797 Americas 7797
Chile -35.6751 -71.543 2020-04-27 15492 198 7327 7967 Americas 7967
Chile -35.6751 -71.543 2020-04-28 16044 207 7710 8127 Americas 8127
Chile -35.6751 -71.543 2020-04-29 16564 216 8057 8291 Americas 8291
Chile -35.6751 -71.543 2020-04-30 17702 227 8580 8895 Americas 8895
Chile -35.6751 -71.543 2020-05-01 18687 234 9018 9435 Americas 9435
Chile -35.6751 -71.543 2020-05-02 21213 247 9572 11394 Americas 11394
Chile -35.6751 -71.543 2020-05-03 22441 260 10041 12140 Americas 12140
Chile -35.6751 -71.543 2020-05-04 23421 270 10415 12736 Americas 12736
Chile -35.6751 -71.543 2020-05-05 24794 275 10710 13809 Americas 13809
Chile -35.6751 -71.543 2020-05-06 25826 281 11189 14356 Americas 14356
Chile -35.6751 -71.543 2020-05-07 27359 285 11664 15410 Americas 15410
Chile -35.6751 -71.543 2020-05-08 28750 294 12160 16296 Americas 16296
Chile -35.6751 -71.543 2020-05-09 32208 304 12667 19237 Americas 19237
Chile -35.6751 -71.543 2020-05-10 33855 312 13112 20431 Americas 20431
Chile -35.6751 -71.543 2020-05-11 35052 323 13605 21124 Americas 21124
Chile -35.6751 -71.543 2020-05-12 36710 335 14125 22250 Americas 22250
Chile -35.6751 -71.543 2020-05-13 39370 346 14865 24159 Americas 24159
Chile -35.6751 -71.543 2020-05-14 42029 368 15655 26006 Americas 26006
Chile -35.6751 -71.543 2020-05-15 44531 394 16614 27523 Americas 27523
Chile -35.6751 -71.543 2020-05-16 50016 421 18014 31581 Americas 31581
Chile -35.6751 -71.543 2020-05-17 52369 450 19213 32706 Americas 32706
Chile -35.6751 -71.543 2020-05-18 54647 478 20165 34004 Americas 34004
Chile -35.6751 -71.543 2020-05-19 58167 509 21507 36151 Americas 36151
Chile -35.6751 -71.543 2020-05-20 62205 544 22504 39157 Americas 39157
Chile -35.6751 -71.543 2020-05-21 66169 589 23992 41588 Americas 41588
Chile -35.6751 -71.543 2020-05-22 70445 630 25342 44473 Americas 44473
Chile -35.6751 -71.543 2020-05-23 80287 673 26546 53068 Americas 53068
Chile -35.6751 -71.543 2020-05-24 83996 718 28148 55130 Americas 55130
Chile -35.6751 -71.543 2020-05-25 88891 761 29302 58828 Americas 58828
Chile -35.6751 -71.543 2020-05-26 92855 806 30915 61134 Americas 61134
Chile -35.6751 -71.543 2020-05-27 97183 841 33540 62802 Americas 62802
Chile -35.6751 -71.543 2020-05-28 101837 890 36115 64832 Americas 64832
Chile -35.6751 -71.543 2020-05-29 105532 944 38598 65990 Americas 65990
Chile -35.6751 -71.543 2020-05-30 118720 997 40431 77292 Americas 77292
Chile -35.6751 -71.543 2020-05-31 123550 1054 42727 79769 Americas 79769
Chile -35.6751 -71.543 2020-06-01 129020 1113 44946 82961 Americas 82961
Chile -35.6751 -71.543 2020-06-02 132548 1188 86173 45187 Americas 45187
Chile -35.6751 -71.543 2020-06-03 137490 1275 90748 45467 Americas 45467
Chile -35.6751 -71.543 2020-06-04 142154 1356 95631 45167 Americas 45167
Chile -35.6751 -71.543 2020-06-05 146361 1448 99358 45555 Americas 45555
Chile -35.6751 -71.543 2020-06-06 160351 1541 103817 54993 Americas 54993
Chile -35.6751 -71.543 2020-06-07 166756 1637 108150 56969 Americas 56969
Chile -35.6751 -71.543 2020-06-08 171452 2264 112248 56940 Americas 56940
Chile -35.6751 -71.543 2020-06-09 175365 2283 117361 55721 Americas 55721
Chile -35.6751 -71.543 2020-06-10 181062 2475 121780 56807 Americas 56807
Chile -35.6751 -71.543 2020-06-11 186698 2648 126444 57606 Americas 57606
Chile -35.6751 -71.543 2020-06-12 193452 2870 131358 59224 Americas 59224
Chile -35.6751 -71.543 2020-06-13 201634 3101 137296 61237 Americas 61237
Chile -35.6751 -71.543 2020-06-14 208572 3323 143704 61545 Americas 61545
Chile -35.6751 -71.543 2020-06-15 213715 3362 148792 61561 Americas 61561
Chile -35.6751 -71.543 2020-06-16 218728 3383 156232 59113 Americas 59113
Chile -35.6751 -71.543 2020-06-17 220628 3615 181931 35082 Americas 35082
Chile -35.6751 -71.543 2020-06-18 225103 3841 186441 34821 Americas 34821
Chile -35.6751 -71.543 2020-06-19 231393 4093 191491 35809 Americas 35809
Chile -35.6751 -71.543 2020-06-20 236748 4295 196609 35844 Americas 35844
Chile -35.6751 -71.543 2020-06-21 242355 4479 200569 37307 Americas 37307
Chile -35.6751 -71.543 2020-06-22 246963 4502 205397 37064 Americas 37064
Chile -35.6751 -71.543 2020-06-23 250767 4505 210570 35692 Americas 35692
Chile -35.6751 -71.543 2020-06-24 254416 4731 215093 34592 Americas 34592
Chile -35.6751 -71.543 2020-06-25 259064 4903 219327 34834 Americas 34834
Chile -35.6751 -71.543 2020-06-26 263360 5068 223431 34861 Americas 34861
Chile -35.6751 -71.543 2020-06-27 267766 5347 228055 34364 Americas 34364
Chile -35.6751 -71.543 2020-06-28 271982 5509 232210 34263 Americas 34263
Chile -35.6751 -71.543 2020-06-29 275999 5575 236154 34270 Americas 34270
Chile -35.6751 -71.543 2020-06-30 279393 5688 241229 32476 Americas 32476
Chile -35.6751 -71.543 2020-07-01 282043 5753 245443 30847 Americas 30847
Chile -35.6751 -71.543 2020-07-02 284541 5920 249247 29374 Americas 29374
Chile -35.6751 -71.543 2020-07-03 288089 6051 253343 28695 Americas 28695
Chile -35.6751 -71.543 2020-07-04 291847 6192 257451 28204 Americas 28204
Chile -35.6751 -71.543 2020-07-05 295532 6308 261039 28185 Americas 28185
Chile -35.6751 -71.543 2020-07-06 298557 6384 264378 27795 Americas 27795
Chile -35.6751 -71.543 2020-07-07 301019 6434 268251 26334 Americas 26334
Chile -35.6751 -71.543 2020-07-08 303083 6573 271741 24769 Americas 24769
Chile -35.6751 -71.543 2020-07-09 306216 6682 274922 24612 Americas 24612
Chile -35.6751 -71.543 2020-07-10 309274 6781 278053 24440 Americas 24440
Chile -35.6751 -71.543 2020-07-11 312029 6881 281114 24034 Americas 24034
Chile -35.6751 -71.543 2020-07-12 315041 6979 283902 24160 Americas 24160
Chile -35.6751 -71.543 2020-07-13 317657 7024 286556 24077 Americas 24077
Chile -35.6751 -71.543 2020-07-14 319493 7069 289220 23204 Americas 23204
Chile -35.6751 -71.543 2020-07-15 321205 7186 292085 21934 Americas 21934
Chile -35.6751 -71.543 2020-07-16 323698 7290 295301 21107 Americas 21107
Chile -35.6751 -71.543 2020-07-17 326439 8347 296814 21278 Americas 21278
Chile -35.6751 -71.543 2020-07-18 328846 8445 299449 20952 Americas 20952
Chile -35.6751 -71.543 2020-07-19 330930 8503 301794 20633 Americas 20633
Chile -35.6751 -71.543 2020-07-20 333029 8633 303992 20404 Americas 20404
Chile -35.6751 -71.543 2020-07-21 334683 8677 306816 19190 Americas 19190
Chile -35.6751 -71.543 2020-07-22 336402 8722 309241 18439 Americas 18439
Chile -35.6751 -71.543 2020-07-23 338759 8838 311431 18490 Americas 18490
Chile -35.6751 -71.543 2020-07-24 341304 8914 313696 18694 Americas 18694
Chile -35.6751 -71.543 2020-07-25 343592 9020 316169 18403 Americas 18403
Chile -35.6751 -71.543 2020-07-26 345790 9112 318095 18583 Americas 18583
Chile -35.6751 -71.543 2020-07-27 347923 9187 319954 18782 Americas 18782

Analisis Geografico

#datos_europa<-datos[datos$Latitud > 38 & datos$Longitud > -25 & datos$Longitud < 30 , ]
#nrow(datos_europa)
datos_europa = datos %>%
  filter(Latitud > 38, between(Longitud, -25, 30))

table (datos_europa$Pais_Region) %>%
  as.data.frame() %>%
  filter(Freq > 0) %>%
  kable() %>%
  kable_styling()
Var1 Freq
Albania 188
Andorra 188
Austria 188
Belarus 188
Belgium 188
Bosnia and Herzegovina 188
Bulgaria 188
Croatia 188
Czechia 188
Denmark 376
Estonia 188
Finland 188
France 188
Germany 188
Greece 188
Holy See 188
Hungary 188
Iceland 188
Ireland 188
Italy 188
Kosovo 188
Latvia 188
Liechtenstein 188
Lithuania 188
Luxembourg 188
Moldova 188
Monaco 188
Montenegro 188
Netherlands 188
North Macedonia 188
Norway 188
Poland 188
Portugal 188
Romania 188
San Marino 188
Serbia 188
Slovakia 188
Slovenia 188
Spain 188
Sweden 188
Switzerland 188
United Kingdom 564
datos_europa %>%
  filter(Fecha == ymd("2020-03-15")) %>%
  kable() %>%
  kable_styling()
Provincia_Estado Pais_Region Latitud Longitud Fecha Casos_Confirmados Casos_Muertos Casos_Recuperados Casos_Activos WHO_Region Casos_Enfermos
Albania 41.15330 20.168300 2020-03-15 42 1 0 41 Europe 41
Andorra 42.50630 1.521800 2020-03-15 1 0 1 0 Europe 0
Austria 47.51620 14.550100 2020-03-15 860 1 6 853 Europe 853
Belarus 53.70980 27.953400 2020-03-15 27 0 3 24 Europe 24
Belgium 50.83330 4.469936 2020-03-15 886 4 1 881 Europe 881
Bosnia and Herzegovina 43.91590 17.679100 2020-03-15 24 0 0 24 Europe 24
Bulgaria 42.73390 25.485800 2020-03-15 51 2 0 49 Europe 49
Croatia 45.10000 15.200000 2020-03-15 49 0 1 48 Europe 48
Czechia 49.81750 15.473000 2020-03-15 253 0 0 253 Europe 253
Faroe Islands Denmark 61.89260 -6.911800 2020-03-15 11 0 0 11 Europe 11
Denmark 56.26390 9.501800 2020-03-15 864 2 1 861 Europe 861
Estonia 58.59530 25.013600 2020-03-15 171 0 1 170 Europe 170
Finland 61.92411 25.748151 2020-03-15 244 0 10 234 Europe 234
France 46.22760 2.213700 2020-03-15 4499 91 12 4396 Europe 4396
Germany 51.16569 10.451526 2020-03-15 5795 11 46 5738 Europe 5738
Greece 39.07420 21.824300 2020-03-15 331 4 8 319 Europe 319
Holy See 41.90290 12.453400 2020-03-15 1 0 0 1 Europe 1
Hungary 47.16250 19.503300 2020-03-15 32 1 1 30 Europe 30
Iceland 64.96310 -19.020800 2020-03-15 171 5 8 158 Europe 158
Ireland 53.14240 -7.692100 2020-03-15 129 2 0 127 Europe 127
Italy 41.87194 12.567380 2020-03-15 24747 1809 2335 20603 Europe 20603
Latvia 56.87960 24.603200 2020-03-15 30 0 1 29 Europe 29
Liechtenstein 47.14000 9.550000 2020-03-15 4 0 1 3 Europe 3
Lithuania 55.16940 23.881300 2020-03-15 12 0 1 11 Europe 11
Luxembourg 49.81530 6.129600 2020-03-15 59 1 0 58 Europe 58
Moldova 47.41160 28.369900 2020-03-15 23 0 0 23 Europe 23
Monaco 43.73330 7.416700 2020-03-15 2 0 0 2 Europe 2
Montenegro 42.70868 19.374390 2020-03-15 0 0 0 0 Europe 0
Netherlands 52.13260 5.291300 2020-03-15 1135 20 0 1115 Europe 1115
North Macedonia 41.60860 21.745300 2020-03-15 14 0 1 13 Europe 13
Norway 60.47200 8.468900 2020-03-15 1221 3 1 1217 Europe 1217
Poland 51.91940 19.145100 2020-03-15 119 3 0 116 Europe 116
Portugal 39.39990 -8.224500 2020-03-15 245 0 2 243 Europe 243
Romania 45.94320 24.966800 2020-03-15 131 0 9 122 Europe 122
San Marino 43.94240 12.457800 2020-03-15 101 5 4 92 Europe 92
Serbia 44.01650 21.005900 2020-03-15 48 0 0 48 Europe 48
Slovakia 48.66900 19.699000 2020-03-15 54 0 0 54 Europe 54
Slovenia 46.15120 14.995500 2020-03-15 219 1 0 218 Europe 218
Spain 40.46367 -3.749220 2020-03-15 7798 289 517 6992 Europe 6992
Sweden 60.12816 18.643501 2020-03-15 1022 3 0 1019 Europe 1019
Switzerland 46.81820 8.227500 2020-03-15 2200 14 4 2182 Europe 2182
Channel Islands United Kingdom 49.37230 -2.364400 2020-03-15 3 0 0 3 Europe 3
Isle of Man United Kingdom 54.23610 -4.548100 2020-03-15 0 0 0 0 Europe 0
United Kingdom 55.37810 -3.436000 2020-03-15 3072 43 18 3011 Europe 3011
Kosovo 42.60264 20.902977 2020-03-15 0 0 0 0 Europe 0

Analisis Amercia Latina

datos_aml = datos %>%
  filter(Latitud < 27 , between(Longitud, -121, -31))

table (datos_aml$Pais_Region) %>%
  as.data.frame() %>%
  filter(Freq > 0) %>%
  kable() %>%
  kable_styling()
Var1 Freq
Antigua and Barbuda 188
Argentina 188
Bahamas 188
Barbados 188
Belize 188
Bolivia 188
Brazil 188
Chile 188
Colombia 188
Costa Rica 188
Cuba 188
Dominica 188
Dominican Republic 188
Ecuador 188
El Salvador 188
France 940
Grenada 188
Guatemala 188
Guyana 188
Haiti 188
Honduras 188
Jamaica 188
Mexico 188
Netherlands 564
Nicaragua 188
Panama 188
Paraguay 188
Peru 188
Saint Kitts and Nevis 188
Saint Lucia 188
Saint Vincent and the Grenadines 188
Suriname 188
Trinidad and Tobago 188
United Kingdom 1128
Uruguay 188
Venezuela 188
datos_aml %>%
  filter(Fecha == ymd("2020-03-3")) %>%
  kable() %>%
  kable_styling()
Provincia_Estado Pais_Region Latitud Longitud Fecha Casos_Confirmados Casos_Muertos Casos_Recuperados Casos_Activos WHO_Region Casos_Enfermos
Antigua and Barbuda 17.060800 -61.79640 2020-03-03 0 0 0 0 Americas 0
Argentina -38.416100 -63.61670 2020-03-03 1 0 0 1 Americas 1
Bahamas 25.025885 -78.03589 2020-03-03 0 0 0 0 Americas 0
Barbados 13.193900 -59.54320 2020-03-03 0 0 0 0 Americas 0
Bolivia -16.290200 -63.58870 2020-03-03 0 0 0 0 Americas 0
Brazil -14.235000 -51.92530 2020-03-03 2 0 0 2 Americas 2
Chile -35.675100 -71.54300 2020-03-03 10 0 0 10 Americas 10
Colombia 4.570900 -74.29730 2020-03-03 0 0 0 0 Americas 0
Costa Rica 9.748900 -83.75340 2020-03-03 0 0 0 0 Americas 0
Cuba 21.521757 -77.78117 2020-03-03 0 0 0 0 Americas 0
Dominican Republic 18.735700 -70.16270 2020-03-03 1 0 0 1 Americas 1
Ecuador -1.831200 -78.18340 2020-03-03 7 0 0 7 Americas 7
El Salvador 13.794200 -88.89650 2020-03-03 0 0 0 0 Americas 0
French Guiana France 3.933900 -53.12580 2020-03-03 0 0 0 0 Europe 0
Guadeloupe France 16.265000 -61.55100 2020-03-03 0 0 0 0 Europe 0
Saint Barthelemy France 17.900000 -62.83330 2020-03-03 0 0 0 0 Europe 0
St Martin France 18.070800 -63.05010 2020-03-03 0 0 0 0 Europe 0
Martinique France 14.641500 -61.02420 2020-03-03 0 0 0 0 Europe 0
Guatemala 15.783500 -90.23080 2020-03-03 0 0 0 0 Americas 0
Guyana 4.860416 -58.93018 2020-03-03 0 0 0 0 Americas 0
Haiti 18.971200 -72.28520 2020-03-03 0 0 0 0 Americas 0
Honduras 15.200000 -86.24190 2020-03-03 0 0 0 0 Americas 0
Jamaica 18.109600 -77.29750 2020-03-03 0 0 0 0 Americas 0
Mexico 23.634500 -102.55280 2020-03-03 5 0 1 4 Americas 4
Aruba Netherlands 12.521100 -69.96830 2020-03-03 0 0 0 0 Europe 0
Curacao Netherlands 12.169600 -68.99000 2020-03-03 0 0 0 0 Europe 0
Sint Maarten Netherlands 18.042500 -63.05480 2020-03-03 0 0 0 0 Europe 0
Nicaragua 12.865416 -85.20723 2020-03-03 0 0 0 0 Americas 0
Panama 8.538000 -80.78210 2020-03-03 0 0 0 0 Americas 0
Paraguay -23.442500 -58.44380 2020-03-03 0 0 0 0 Americas 0
Peru -9.190000 -75.01520 2020-03-03 0 0 0 0 Americas 0
Saint Lucia 13.909400 -60.97890 2020-03-03 0 0 0 0 Americas 0
Saint Vincent and the Grenadines 12.984300 -61.28720 2020-03-03 0 0 0 0 Americas 0
Suriname 3.919300 -56.02780 2020-03-03 0 0 0 0 Americas 0
Trinidad and Tobago 10.691800 -61.22250 2020-03-03 0 0 0 0 Americas 0
Cayman Islands United Kingdom 19.313300 -81.25460 2020-03-03 0 0 0 0 Europe 0
Montserrat United Kingdom 16.742498 -62.18737 2020-03-03 0 0 0 0 Europe 0
Uruguay -32.522800 -55.76580 2020-03-03 0 0 0 0 Americas 0
Venezuela 6.423800 -66.58970 2020-03-03 0 0 0 0 Americas 0
Dominica 15.415000 -61.37100 2020-03-03 0 0 0 0 Americas 0
Grenada 12.116500 -61.67900 2020-03-03 0 0 0 0 Americas 0
Belize 17.189900 -88.49760 2020-03-03 0 0 0 0 Americas 0
Saint Kitts and Nevis 17.357822 -62.78300 2020-03-03 0 0 0 0 Americas 0
Anguilla United Kingdom 18.220600 -63.06860 2020-03-03 0 0 0 0 Europe 0
British Virgin Islands United Kingdom 18.420700 -64.64000 2020-03-03 0 0 0 0 Europe 0
Turks and Caicos Islands United Kingdom 21.694000 -71.79790 2020-03-03 0 0 0 0 Europe 0
Falkland Islands (Malvinas) United Kingdom -51.796300 -59.52360 2020-03-03 0 0 0 0 Europe 0

Mapas

world<-ne_countries(scale = "large", returnclass = "sf")
ggplot(data = world) +
  geom_sf(color = "red", fill = "green") +
  xlab("Logitud") + ylab("Latitud")+
  ggtitle("Mapa del mundo", subtitle = "COVID 19")

world<-ne_countries(scale = "large", returnclass = "sf")
world2<-ne_countries(scale = "medium", returnclass = "sf")

#datos$Pais_Region = factor(datos$Pais_Region, levels = c(levels(datos$Pais_Region), "United States of America"))


#datos[datos$Pais_Region=="United States",]$Pais_Region ="United States of America"
world %>%
  inner_join(datos, by = c("name"= "Pais_Region")) %>%
  filter(Fecha == dmy("10-06-2020")) %>%
  ggplot() +
  geom_sf(color = "black", aes(fill = Casos_Confirmados)) +
  scale_fill_viridis_c(option = "plasma", trans ="sqrt")+
  xlab("Logitud") + ylab("Latitud")+
  ggtitle("Mapa del mundo", subtitle = "COVID 19")

datos %>%
  filter(Fecha == dmy("20-4-2020")) %>%
  ggplot(aes(Longitud, Latitud))+
  geom_point(aes(size=log(Casos_Confirmados+1), colour=log(Casos_Muertos+1)))+
  coord_fixed()+
  theme(legend.position = "bottom") -> g


ggplotly(g)
thr = 50000

datos %>%
  filter(Fecha == ymd("2020-07-27"), Casos_Confirmados > thr) %>%
  mutate(Prop_Muertos = Casos_Muertos / Casos_Confirmados, Ranking = dense_rank(desc(Prop_Muertos))) %>%
  arrange(Ranking) %>%
  head(20) %>%
  kable() %>%
  kable_styling()
Provincia_Estado Pais_Region Latitud Longitud Fecha Casos_Confirmados Casos_Muertos Casos_Recuperados Casos_Activos WHO_Region Casos_Enfermos Prop_Muertos Ranking
United Kingdom 55.37810 -3.436000 2020-07-27 300111 45759 0 254352 Europe 254352 0.1524736 1
Belgium 50.83330 4.469936 2020-07-27 66428 9822 17452 39154 Europe 39154 0.1478593 2
France 46.22760 2.213700 2020-07-27 208665 30096 71497 107072 Europe 107072 0.1442312 3
Italy 41.87194 12.567380 2020-07-27 246286 35112 198593 12581 Europe 12581 0.1425660 4
Netherlands 52.13260 5.291300 2020-07-27 53151 6141 0 47010 Europe 47010 0.1155387 5
Mexico 23.63450 -102.552800 2020-07-27 395489 44022 303810 47657 Americas 47657 0.1113103 6
Spain 40.46367 -3.749220 2020-07-27 272421 28432 150376 93613 Europe 93613 0.1043679 7
Quebec Canada 52.93990 -73.549100 2020-07-27 58728 5667 0 53061 Americas 53061 0.0964957 8
Sweden 60.12816 18.643501 2020-07-27 79395 5700 0 73695 Europe 73695 0.0717929 9
Ecuador -1.83120 -78.183400 2020-07-27 81161 5532 34896 40733 Americas 40733 0.0681608 10
Hubei China 30.97560 112.270700 2020-07-27 68135 4512 63623 0 Western Pacific 0 0.0662215 11
Iran 32.42791 53.688046 2020-07-27 293606 15912 255144 22550 Eastern Mediterranean 22550 0.0541951 12
Egypt 26.82055 30.802498 2020-07-27 92482 4652 34838 52992 Eastern Mediterranean 52992 0.0503017 13
Indonesia -0.78930 113.921300 2020-07-27 100303 4838 58173 37292 South-East Asia 37292 0.0482339 14
Peru -9.19000 -75.015200 2020-07-27 389717 18418 272547 98752 Americas 98752 0.0472599 15
Germany 51.16569 10.451526 2020-07-27 207112 9125 190314 7673 Europe 7673 0.0440583 16
Iraq 33.22319 43.679291 2020-07-27 112585 4458 77144 30983 Eastern Mediterranean 30983 0.0395967 17
Bolivia -16.29020 -63.588700 2020-07-27 71181 2647 21478 47056 Americas 47056 0.0371869 18
Brazil -14.23500 -51.925300 2020-07-27 2442375 87618 1846641 508116 Americas 508116 0.0358741 19
US 40.00000 -100.000000 2020-07-27 4290259 148011 1325804 2816444 Americas 2816444 0.0344993 20
datos$lat_class = cut(datos$Latitud, breaks = nclass.scott(datos$Latitud))
datos$long_class = cut(datos$Longitud, breaks = nclass.Sturges(datos$Longitud))

tt = table(datos$lat_class, datos$long_class)
tt = tt[nrow(tt):1,]
mosaicplot(t(tt), shade = TRUE)

Series Temporales

datos_por_fecha<-aggregate(
  cbind(Casos_Confirmados, Casos_Muertos, Casos_Recuperados) ~ Fecha,
  data = datos,
  FUN = sum)

head(datos_por_fecha)
##        Fecha Casos_Confirmados Casos_Muertos Casos_Recuperados
## 1 2020-01-22               555            17                28
## 2 2020-01-23               654            18                30
## 3 2020-01-24               941            26                36
## 4 2020-01-25              1434            42                39
## 5 2020-01-26              2118            56                52
## 6 2020-01-27              2927            82                61
tail(datos_por_fecha)
##          Fecha Casos_Confirmados Casos_Muertos Casos_Recuperados
## 183 2020-07-22          15227725        623540           8541255
## 184 2020-07-23          15510481        633506           8710969
## 185 2020-07-24          15791645        639650           8939705
## 186 2020-07-25          16047190        644517           9158743
## 187 2020-07-26          16251796        648621           9293464
## 188 2020-07-27          16480485        654036           9468087
barplot(Casos_Confirmados ~ Fecha, data=datos_por_fecha)

plot(Casos_Confirmados ~ Fecha, data= datos_por_fecha, col ="blue", type ="l",
     main="Casos Documentados", xlab="Fecha", ylab="Numeros de Personas", log="y" )
lines(Casos_Muertos ~ Fecha, data=datos_por_fecha, col="red")
lines(Casos_Recuperados ~ Fecha, data=datos_por_fecha, col="green" )
legend("topleft", c("Confirmados", "Muertos", "Recuperados"), col=c("blue", "red", "green"), pch = 1, lwd = 2)

datos_por_fecha_ts<-xts(x=datos_por_fecha[,2:4], order.by = datos_por_fecha$Fecha)

dygraph(datos_por_fecha_ts)%>%
  dyOptions(labelsKMB = TRUE,
      fillGraph = TRUE, fillAlpha = 0,05,
      drawGrid = FALSE) %>%
  dyRangeSelector() %>%
  dyCrosshair(direction = "vertical")%>%
  dyHighlight(highlightCircleSize = 5, highlightSeriesBackgroundAlpha = 0.2,hideOnMouseOut = FALSE) %>%
  dyRoller(rollPeriod = 2)
datos_chile<-datos %>% 
  filter(Pais_Region== "Chile") %>%
  select(Fecha, starts_with("Casos_"))

plot(x=datos_chile$Fecha, y=datos_chile$Casos_Confirmados, main="Casos Chile", type="s", col="blue", lwd=2)

barplot(as.matrix(t(datos_chile[,3:5])), 
        col = c("red", "green", "yellow"),
        main="Casos Chile",
        xlab="Fecha", ylab = "Personas")
legend("topleft", c("Muertos", "Recuperados", "Enfermos"),
       col=c("red", "green", "yellow"), lwd=2, pch = 1)

# Nuevos Casos

datos_chile %<>%
  mutate(Nuevos_Casos_Confirmados =Casos_Confirmados- lag(Casos_Confirmados, n=1),
         Nuevos_Casos_Muerto = Casos_Muertos - lag(Casos_Muertos, n=1),
         Nuevos_Casos_Recuperados = Casos_Recuperados - lag(Casos_Recuperados, n=1))

datos_chile %>% kable() %>% kable_styling()
Fecha Casos_Confirmados Casos_Muertos Casos_Recuperados Casos_Activos Casos_Enfermos Nuevos_Casos_Confirmados Nuevos_Casos_Muerto Nuevos_Casos_Recuperados
2020-01-22 0 0 0 0 0 NA NA NA
2020-01-23 0 0 0 0 0 0 0 0
2020-01-24 0 0 0 0 0 0 0 0
2020-01-25 0 0 0 0 0 0 0 0
2020-01-26 0 0 0 0 0 0 0 0
2020-01-27 0 0 0 0 0 0 0 0
2020-01-28 0 0 0 0 0 0 0 0
2020-01-29 0 0 0 0 0 0 0 0
2020-01-30 0 0 0 0 0 0 0 0
2020-01-31 0 0 0 0 0 0 0 0
2020-02-01 0 0 0 0 0 0 0 0
2020-02-02 0 0 0 0 0 0 0 0
2020-02-03 0 0 0 0 0 0 0 0
2020-02-04 0 0 0 0 0 0 0 0
2020-02-05 0 0 0 0 0 0 0 0
2020-02-06 0 0 0 0 0 0 0 0
2020-02-07 0 0 0 0 0 0 0 0
2020-02-08 0 0 0 0 0 0 0 0
2020-02-09 0 0 0 0 0 0 0 0
2020-02-10 0 0 0 0 0 0 0 0
2020-02-11 0 0 0 0 0 0 0 0
2020-02-12 0 0 0 0 0 0 0 0
2020-02-13 0 0 0 0 0 0 0 0
2020-02-14 0 0 0 0 0 0 0 0
2020-02-15 0 0 0 0 0 0 0 0
2020-02-16 0 0 0 0 0 0 0 0
2020-02-17 0 0 0 0 0 0 0 0
2020-02-18 0 0 0 0 0 0 0 0
2020-02-19 0 0 0 0 0 0 0 0
2020-02-20 0 0 0 0 0 0 0 0
2020-02-21 0 0 0 0 0 0 0 0
2020-02-22 0 0 0 0 0 0 0 0
2020-02-23 2 0 0 2 2 2 0 0
2020-02-24 2 0 0 2 2 0 0 0
2020-02-25 2 0 0 2 2 0 0 0
2020-02-26 2 0 0 2 2 0 0 0
2020-02-27 2 0 0 2 2 0 0 0
2020-02-28 2 0 0 2 2 0 0 0
2020-02-29 2 0 0 2 2 0 0 0
2020-03-01 9 0 0 9 9 7 0 0
2020-03-02 9 0 0 9 9 0 0 0
2020-03-03 10 0 0 10 10 1 0 0
2020-03-04 10 0 0 10 10 0 0 0
2020-03-05 13 0 0 13 13 3 0 0
2020-03-06 13 0 0 13 13 0 0 0
2020-03-07 13 0 0 13 13 0 0 0
2020-03-08 20 0 0 20 20 7 0 0
2020-03-09 20 0 0 20 20 0 0 0
2020-03-10 25 0 0 25 25 5 0 0
2020-03-11 35 0 0 35 35 10 0 0
2020-03-12 35 0 0 35 35 0 0 0
2020-03-13 55 0 0 55 55 20 0 0
2020-03-14 88 0 0 88 88 33 0 0
2020-03-15 101 0 0 101 101 13 0 0
2020-03-16 182 0 0 182 182 81 0 0
2020-03-17 228 0 0 228 228 46 0 0
2020-03-18 265 0 0 265 265 37 0 0
2020-03-19 265 0 0 265 265 0 0 0
2020-03-20 461 0 6 455 455 196 0 6
2020-03-21 592 0 6 586 586 131 0 0
2020-03-22 687 1 8 678 678 95 1 2
2020-03-23 801 2 8 791 791 114 1 0
2020-03-24 977 2 17 958 958 176 0 9
2020-03-25 1197 3 22 1172 1172 220 1 5
2020-03-26 1361 4 22 1335 1335 164 1 0
2020-03-27 1665 5 43 1617 1617 304 1 21
2020-03-28 2015 6 61 1948 1948 350 1 18
2020-03-29 2245 7 75 2163 2163 230 1 14
2020-03-30 2555 8 156 2391 2391 310 1 81
2020-03-31 2844 12 156 2676 2676 289 4 0
2020-04-01 3137 16 234 2887 2887 293 4 78
2020-04-02 3510 18 335 3157 3157 373 2 101
2020-04-03 3843 22 427 3394 3394 333 4 92
2020-04-04 4355 27 528 3800 3800 512 5 101
2020-04-05 4665 34 618 4013 4013 310 7 90
2020-04-06 5009 37 728 4244 4244 344 3 110
2020-04-07 5310 43 898 4369 4369 301 6 170
2020-04-08 5740 48 1115 4577 4577 430 5 217
2020-04-09 6166 57 1274 4835 4835 426 9 159
2020-04-10 6695 65 1571 5059 5059 529 8 297
2020-04-11 7366 73 1864 5429 5429 671 8 293
2020-04-12 7652 80 2059 5513 5513 286 7 195
2020-04-13 7964 82 2367 5515 5515 312 2 308
2020-04-14 8356 92 2646 5618 5618 392 10 279
2020-04-15 8712 94 2937 5681 5681 356 2 291
2020-04-16 9246 105 3299 5842 5842 534 11 362
2020-04-17 9691 116 3621 5954 5954 445 11 322
2020-04-18 10598 126 4035 6437 6437 907 10 414
2020-04-19 10956 133 4338 6485 6485 358 7 303
2020-04-20 11375 139 4676 6560 6560 419 6 338
2020-04-21 11700 147 4969 6584 6584 325 8 293
2020-04-22 12164 160 5386 6618 6618 464 13 417
2020-04-23 12680 168 5804 6708 6708 516 8 418
2020-04-24 13174 174 6327 6673 6673 494 6 523
2020-04-25 14537 181 6746 7610 7610 1363 7 419
2020-04-26 15010 189 7024 7797 7797 473 8 278
2020-04-27 15492 198 7327 7967 7967 482 9 303
2020-04-28 16044 207 7710 8127 8127 552 9 383
2020-04-29 16564 216 8057 8291 8291 520 9 347
2020-04-30 17702 227 8580 8895 8895 1138 11 523
2020-05-01 18687 234 9018 9435 9435 985 7 438
2020-05-02 21213 247 9572 11394 11394 2526 13 554
2020-05-03 22441 260 10041 12140 12140 1228 13 469
2020-05-04 23421 270 10415 12736 12736 980 10 374
2020-05-05 24794 275 10710 13809 13809 1373 5 295
2020-05-06 25826 281 11189 14356 14356 1032 6 479
2020-05-07 27359 285 11664 15410 15410 1533 4 475
2020-05-08 28750 294 12160 16296 16296 1391 9 496
2020-05-09 32208 304 12667 19237 19237 3458 10 507
2020-05-10 33855 312 13112 20431 20431 1647 8 445
2020-05-11 35052 323 13605 21124 21124 1197 11 493
2020-05-12 36710 335 14125 22250 22250 1658 12 520
2020-05-13 39370 346 14865 24159 24159 2660 11 740
2020-05-14 42029 368 15655 26006 26006 2659 22 790
2020-05-15 44531 394 16614 27523 27523 2502 26 959
2020-05-16 50016 421 18014 31581 31581 5485 27 1400
2020-05-17 52369 450 19213 32706 32706 2353 29 1199
2020-05-18 54647 478 20165 34004 34004 2278 28 952
2020-05-19 58167 509 21507 36151 36151 3520 31 1342
2020-05-20 62205 544 22504 39157 39157 4038 35 997
2020-05-21 66169 589 23992 41588 41588 3964 45 1488
2020-05-22 70445 630 25342 44473 44473 4276 41 1350
2020-05-23 80287 673 26546 53068 53068 9842 43 1204
2020-05-24 83996 718 28148 55130 55130 3709 45 1602
2020-05-25 88891 761 29302 58828 58828 4895 43 1154
2020-05-26 92855 806 30915 61134 61134 3964 45 1613
2020-05-27 97183 841 33540 62802 62802 4328 35 2625
2020-05-28 101837 890 36115 64832 64832 4654 49 2575
2020-05-29 105532 944 38598 65990 65990 3695 54 2483
2020-05-30 118720 997 40431 77292 77292 13188 53 1833
2020-05-31 123550 1054 42727 79769 79769 4830 57 2296
2020-06-01 129020 1113 44946 82961 82961 5470 59 2219
2020-06-02 132548 1188 86173 45187 45187 3528 75 41227
2020-06-03 137490 1275 90748 45467 45467 4942 87 4575
2020-06-04 142154 1356 95631 45167 45167 4664 81 4883
2020-06-05 146361 1448 99358 45555 45555 4207 92 3727
2020-06-06 160351 1541 103817 54993 54993 13990 93 4459
2020-06-07 166756 1637 108150 56969 56969 6405 96 4333
2020-06-08 171452 2264 112248 56940 56940 4696 627 4098
2020-06-09 175365 2283 117361 55721 55721 3913 19 5113
2020-06-10 181062 2475 121780 56807 56807 5697 192 4419
2020-06-11 186698 2648 126444 57606 57606 5636 173 4664
2020-06-12 193452 2870 131358 59224 59224 6754 222 4914
2020-06-13 201634 3101 137296 61237 61237 8182 231 5938
2020-06-14 208572 3323 143704 61545 61545 6938 222 6408
2020-06-15 213715 3362 148792 61561 61561 5143 39 5088
2020-06-16 218728 3383 156232 59113 59113 5013 21 7440
2020-06-17 220628 3615 181931 35082 35082 1900 232 25699
2020-06-18 225103 3841 186441 34821 34821 4475 226 4510
2020-06-19 231393 4093 191491 35809 35809 6290 252 5050
2020-06-20 236748 4295 196609 35844 35844 5355 202 5118
2020-06-21 242355 4479 200569 37307 37307 5607 184 3960
2020-06-22 246963 4502 205397 37064 37064 4608 23 4828
2020-06-23 250767 4505 210570 35692 35692 3804 3 5173
2020-06-24 254416 4731 215093 34592 34592 3649 226 4523
2020-06-25 259064 4903 219327 34834 34834 4648 172 4234
2020-06-26 263360 5068 223431 34861 34861 4296 165 4104
2020-06-27 267766 5347 228055 34364 34364 4406 279 4624
2020-06-28 271982 5509 232210 34263 34263 4216 162 4155
2020-06-29 275999 5575 236154 34270 34270 4017 66 3944
2020-06-30 279393 5688 241229 32476 32476 3394 113 5075
2020-07-01 282043 5753 245443 30847 30847 2650 65 4214
2020-07-02 284541 5920 249247 29374 29374 2498 167 3804
2020-07-03 288089 6051 253343 28695 28695 3548 131 4096
2020-07-04 291847 6192 257451 28204 28204 3758 141 4108
2020-07-05 295532 6308 261039 28185 28185 3685 116 3588
2020-07-06 298557 6384 264378 27795 27795 3025 76 3339
2020-07-07 301019 6434 268251 26334 26334 2462 50 3873
2020-07-08 303083 6573 271741 24769 24769 2064 139 3490
2020-07-09 306216 6682 274922 24612 24612 3133 109 3181
2020-07-10 309274 6781 278053 24440 24440 3058 99 3131
2020-07-11 312029 6881 281114 24034 24034 2755 100 3061
2020-07-12 315041 6979 283902 24160 24160 3012 98 2788
2020-07-13 317657 7024 286556 24077 24077 2616 45 2654
2020-07-14 319493 7069 289220 23204 23204 1836 45 2664
2020-07-15 321205 7186 292085 21934 21934 1712 117 2865
2020-07-16 323698 7290 295301 21107 21107 2493 104 3216
2020-07-17 326439 8347 296814 21278 21278 2741 1057 1513
2020-07-18 328846 8445 299449 20952 20952 2407 98 2635
2020-07-19 330930 8503 301794 20633 20633 2084 58 2345
2020-07-20 333029 8633 303992 20404 20404 2099 130 2198
2020-07-21 334683 8677 306816 19190 19190 1654 44 2824
2020-07-22 336402 8722 309241 18439 18439 1719 45 2425
2020-07-23 338759 8838 311431 18490 18490 2357 116 2190
2020-07-24 341304 8914 313696 18694 18694 2545 76 2265
2020-07-25 343592 9020 316169 18403 18403 2288 106 2473
2020-07-26 345790 9112 318095 18583 18583 2198 92 1926
2020-07-27 347923 9187 319954 18782 18782 2133 75 1859
plot(Nuevos_Casos_Confirmados ~ Fecha, data = datos_chile,
     type = "l", col ="blue", 
     xlab = "Fecha", ylab = "Nuevos casos", 
     main = "Nuevos registros en Chile")
lines(Nuevos_Casos_Muerto ~ Fecha, data = datos_chile,
      type = "l", col = "red")
lines(Nuevos_Casos_Recuperados ~ Fecha, data = datos_chile,
      type = "l", col = "green")
legend("topleft", c("Confirmados", "Muertos", "Recuperados"), 
       col = c("blue", "red", "green"), 
       lwd = 2, pch = 1)

Cohortes

primer_contagio <- datos %>%
  group_by(Pais_Region) %>%
  filter(Casos_Confirmados > 0) %>%
  summarise(Primero = min(Fecha)-1)
## `summarise()` ungrouping output (override with `.groups` argument)
data_first <- datos %>%
  inner_join(primer_contagio, by="Pais_Region") %>%
  mutate(Dias_Desde_PC = as.numeric(Fecha - Primero))%>%
  filter(Dias_Desde_PC >=0)%>%
  group_by(Dias_Desde_PC, Pais_Region)%>%
  summarise(Casos_Confirmados = sum(Casos_Confirmados),
            Casos_Muertos = sum(Casos_Muertos),
            Casos_Recuperados = sum(Casos_Recuperados))
## `summarise()` regrouping output by 'Dias_Desde_PC' (override with `.groups` argument)
data_first %>%
  filter(Pais_Region %in% c("Chile", "Peru", "Argentina", "China", "US")) %>%
  ggplot(aes(x= Dias_Desde_PC, y = Casos_Confirmados)) +
  geom_line(aes(col =Pais_Region)) +
  xlab("Dias desde primer contagio")+
  ylab("Personas")+
  ggtitle("Analisis por Cohorte - Casos Confirmados")+
  theme(legend.position = "none") -> h

ggplotly(h)
data_first %>%
  filter(Pais_Region %in% c("Chile", "Peru", "Argentina", "China", "US")) %>%
  ggplot(aes(x= Dias_Desde_PC, y = Casos_Muertos)) +
  geom_line(aes(col =Pais_Region)) +
  xlab("Dias desde primer contagio")+
  ylab("Personas")+
  ggtitle("Analisis por Cohorte - Muertes")+
  theme(legend.position = "none") -> g

ggplotly(g)

Modelos de Regresion

datos_chile$Dias <- as.numeric(datos_chile$Fecha - dmy("22/01/2020"))

Regresion Lineal

mod1<- lm(Casos_Confirmados ~ Dias, data = datos_chile)
summary(mod1)
## 
## Call:
## lm(formula = Casos_Confirmados ~ Dias, data = datos_chile)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -87613 -55413   1431  57268  91927 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -91926.66    8442.17  -10.89   <2e-16 ***
## Dias          1946.63      78.09   24.93   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 58110 on 186 degrees of freedom
## Multiple R-squared:  0.7696, Adjusted R-squared:  0.7684 
## F-statistic: 621.4 on 1 and 186 DF,  p-value: < 2.2e-16
plot(datos_chile$Dias, datos_chile$Casos_Confirmados)
abline(mod1, col ="red")

# Residuo es el Error y los valores ajustados es la prediccion
plot(mod1$residuals ~ mod1$fitted.values, xlab="Valores Ajustados", ylab = "Residuos")

residuos <-mod1$residuals

qqPlot(residuos, distribution = "norm", mean= mean(residuos), sd=sd(residuos))

## [1] 1 2

Regresion Exponencial

mod2<-lm(log(Casos_Confirmados) ~ Dias, data= datos_chile[datos_chile$Casos_Confirmados>0, ])
summary(mod2)
## 
## Call:
## lm(formula = log(Casos_Confirmados) ~ Dias, data = datos_chile[datos_chile$Casos_Confirmados > 
##     0, ])
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.6994 -0.9694  0.5904  1.0632  1.5451 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 1.708172   0.294128   5.808 3.51e-08 ***
## Dias        0.070643   0.002484  28.436  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.397 on 154 degrees of freedom
## Multiple R-squared:   0.84,  Adjusted R-squared:  0.839 
## F-statistic: 808.6 on 1 and 154 DF,  p-value: < 2.2e-16
plot(datos_chile$Dias, datos_chile$Casos_Confirmados)
lines(exp(mod2$coefficients[1])*exp(mod2$coefficients[2]*datos_chile$Dias), col="blue")

plot(mod2$residuals ~ mod2$fitted.values, xlab="Valores ajustados", ylab="Residuos")

residuos2 <-mod2$residuals
qqPlot(residuos2, distribution = "norm", mean = mean(residuos2), sd=sd(residuos2))

## 39 38 
##  7  6

Regresion Potencial

mod3 <- lm(log(Casos_Confirmados) ~ log(Dias), data = datos_chile[datos_chile$Casos_Confirmados >0,] )
summary(mod3)
## 
## Call:
## lm(formula = log(Casos_Confirmados) ~ log(Dias), data = datos_chile[datos_chile$Casos_Confirmados > 
##     0, ])
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.9399 -0.6021  0.2460  0.3864  1.0969 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -23.2705     0.5507  -42.25   <2e-16 ***
## log(Dias)     7.1211     0.1192   59.72   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.7107 on 154 degrees of freedom
## Multiple R-squared:  0.9586, Adjusted R-squared:  0.9583 
## F-statistic:  3567 on 1 and 154 DF,  p-value: < 2.2e-16
plot(datos_chile$Dias, datos_chile$Casos_Confirmados)
lines(exp(mod3$coefficients[1])*datos_chile$Dias^mod3$coefficients[2], col="green")

plot(mod3$residuals ~ mod3$fitted.values, xlab="Valores Ajustados", ylab="Residuos")

residuos3<- mod3$residuals
qqPlot(residuos3, distribution = "norm", mean=mean(residuos3), sd=sd(residuos3))

## 39 38 
##  7  6